package com.example.demofdfs.model;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;

import io.swagger.annotations.ApiModelProperty;

public abstract class BaseEntity {

	@ApiModelProperty(value = "用户id", required = false)
	protected Integer id;

	@ApiModelProperty(value = "用户名", required = true)
	protected String name;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	
	@NotEmpty(message = "用户名不能为空")
	@Size(min = 1, max = 10, message = "范围")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@Override
	public String toString() {
		return "User [id=" + id + ", name=" + name + "]";
	}
	
	protected boolean isNew() {
		return id == null || id == 0;
	}
}
